﻿
@{
    Layout = null;
}
<style>
    #LogList {
        width: 100%;
    }
    .WorkConfig .info {
        text-align: left;
    }
</style>
<section class="content WorkConfig">
    <div class="row">
        <div class="col-md-12">
            <div class="box box-primary">
                <div class="box-header with-border">
                    <table style="width: 740px; margin-left: auto; margin-right: auto">
                        <tr class="icheckboxStyle">
                            <td style="text-align: right; width: 240px">
                                <div>
                                    <label for="IsTest">
                                        测试采集
                                    </label>
                                    <input id="IsTest" type="checkbox" />
                                </div>
                                <div>
                                    <label for="Reverse">
                                        倒序采集
                                    </label>
                                    <input type="checkbox" ID="Reverse" />
                                </div>
                                <div>
                                    <label for="IsUpdate">
                                        更新模式
                                    </label>
                                    <input id="IsUpdate" type="checkbox" />
                                </div>
                            </td>
                            <td style="text-align: right; width: 240px">
                                <div>
                                    <label for="LogErr">
                                        记录错误
                                    </label>
                                    <input id="LogErr" data-bind="value:LogErr,checked:LogErr" type="checkbox" checked="checked" />
                                </div>
                                <div>
                                    <label for="LogAlert">
                                        记录警告
                                    </label>
                                    <input id="LogAlert" data-bind="value:LogAlert,checked:LogAlert" type="checkbox" />
                                </div>
                                <div>
                                    <label for="LogRight">
                                        记录正常
                                    </label>
                                    <input id="LogRight" data-bind="value:LogRight,checked:LogRight" type="checkbox" />
                                </div>
                            </td>
                            <td style="text-align: right; width: 240px;">
                                <div>
                                    <label for="IsLeech">
                                        反反盗链
                                    </label>
                                    <input id="IsLeech" type="checkbox" />
                                </div>
                                <div>
                                    <span class="help-inline">同时采集</span>
                                    <input id="Gatherthread" data-bind="value:thread" type="number" value="5" style="width: 60px;" />

                                </div>
                                <div>
                                    <span class="help-inline">容忍图片死链接</span>
                                    <input id="BadLinkNum" type="number" value="0" style="width: 60px;" />
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td style="text-align: center;" colspan="3">
                                <div class="text-center">
                                    <div class="btn-group" id="divbuttonArea">
                                        <input id="btnstart" type="button" data-bind="click:Start" class="btn btn-primary" value="采集" />
                                        <input id="btnstop" type="button" data-bind="click:Stop" class="btn btn-default" value="停止" disabled="disabled" />
                                        @*<input type="button" data-bind="click:WriteLog" class="btn btn-default" value="停止日志" />*@
                                        <input type="button" data-bind="click:ClearLog" class="btn btn-default" value="清空日志" />
                                    </div>
                                </div>
                                <div style="text-align: center; font-weight: bold;">
                                    当前采集 / 跳过采集：
                                    <span data-bind="text:ProgressNum" id="ProgressNum">0</span> /
                                    <span id="ProgressIgnoreNum" data-bind="text:ProgressIgnoreNum">0</span>
                                </div>
                            </td>
                        </tr>
                    </table>
                </div>
                <div class="box-body">
                    <table id="LogList" class="table table-bordered table-striped table-hover dataTable text-center no-footer" role="grid" aria-describedby="dataTable_info" style="width: 100%;">
                        <thead>
                            <tr role="row">

                                <th class="sorting_disabled editableCol" style="width: 150px">标题</th>
                                <th class="sorting_disabled center">入库时间</th>

                            </tr>
                        </thead>
                        <tbody data-bind="foreach:MsgList,visible:MsgList().length>0">
                            <tr>
                                <td class="time" data-bind="text:time"></td>
                                <td class="info" data-bind="html:info"></td>
                            </tr>
                        </tbody>
                        <tfoot data-bind="visible:MsgList().length==0">
                            <tr class="odd">
                                <td colspan="2" class="dataTables_empty">没有数据显示</td>
                            </tr>
                        </tfoot>
                    </table>



                </div>
            </div>
        </div>
    </div>
</section>
<script src="~/Areas/CMS/ViewModel/Gather/Work.js"></script>
<script>
    $(function () {
        var vm = new WorkViewModel();
        vm.GatherIds = '@ViewBag.Ids';
        ko.applyBindings(vm, $(".WorkConfig")[0]);
    });
</script>